New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PAYARA-1896 Unified asadmin command to set health check notifier configuration #3663
PAYARA-1896 Unified asadmin command to set health check notifier configuration #3663
Conversation
jenkins test |
Can you remember to use the JIRA number in commit comments and PR names. That way JIRA picks up all the changes and associates with your PR. |
...n/java/fish/payara/nucleus/healthcheck/admin/SetHealthCheckServiceNotifierConfiguration.java
Show resolved
Hide resolved
...n/java/fish/payara/nucleus/healthcheck/admin/SetHealthCheckServiceNotifierConfiguration.java
Show resolved
Hide resolved
...n/java/fish/payara/nucleus/healthcheck/admin/SetHealthCheckServiceNotifierConfiguration.java
Outdated
Show resolved
Hide resolved
report.setExtraProperties(extraProperties); | ||
} | ||
try { | ||
notifierType = NotifierType.valueOf(notifierName.toUpperCase()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I intentionally chose to not use acceptableValues
to allow the command adopt automatically to changes to the enum.
jenkins test please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Styling
* {@link NotificationServiceConfiguration} to use its {@link NotifierConfiguration#getNoisy()} as automatic fallback | ||
* setting. | ||
* | ||
* @author jan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full name please
final Notifier notifier = selectByType(Notifier.class, config.getNotifierList()); | ||
try { | ||
if (notifier == null) { | ||
ConfigSupport.apply((SingleConfigCode<HealthCheckServiceConfiguration>) proxy -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configProxy
or healthCheckServiceConfigProxy
please
} | ||
|
||
private <T> T selectByType(Class<? super T> commonInterface, List<T> candidates) { | ||
for (T e : candidates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use single character variables please
jenkins test please |
…ommands PAYARA-1896 Unified asadmin command to set health check notifier configuration
This PR is only one part of the effort of PAYARA-1896 split for easier review.
Goal was to combine the various asadmin commands to set individual health check notifier configurations into one command. To not break existing commands these were deprecated and a new command
set-healthcheck-service-notifier-configuration
was added.The working principle of the new service is largely based on the
BaseHealthCheckNotifierConfigurer
that was the base class for the various specific commands.The new command has an additional parameter to specify the type of notifier the setting should apply to. The list of possible values is based on the enum
NotifierType
. The code is entirely written so newly added types of notifiers do not require changes to this service/command.Like the
BaseHealthCheckNotifierConfigurer
this implementation uses a default value fornoisy
resolved from the correspondingNotifierConfiguration
. Unlike theBaseHealthCheckNotifierConfigurer
implementation this value is not resolved by running another command and resolving the flag from theActionReport
. Instead the correspondingNotifierConfiguration
instance is directly resolved from theNotificationServiceConfiguration
so that the flag can be read directly usingNotifierConfiguration#getNoisy()
. This allows services to be less entangled and reliant upon each other which should result in a more stable behaviour.The new command also prints feedback on the changes to the config. It will only apply and report actual changes, that is a setting changing from
true
tofalse
or vice versa.Example session: